home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / vidhrdw / jack.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  2KB  |  107 lines

  1. /***************************************************************************
  2.  
  3.   vidhrdw/jack.c
  4.  
  5.   Functions to emulate the video hardware of the machine.
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12. static int flipscreen = 0;
  13.  
  14. WRITE_HANDLER( jack_paletteram_w )
  15. {
  16.     /* RGB output is inverted */
  17.     paletteram_BBGGGRRR_w(offset,~data);
  18. }
  19.  
  20.  
  21. READ_HANDLER( jack_flipscreen_r )
  22. {
  23.     if (offset != flipscreen)
  24.     {
  25.         flipscreen = offset;
  26.         memset(dirtybuffer,1,videoram_size);
  27.     }
  28.  
  29.     return 0;
  30. }
  31.  
  32. WRITE_HANDLER( jack_flipscreen_w )
  33. {
  34.     jack_flipscreen_r(offset);
  35. }
  36.  
  37.  
  38. void jack_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
  39. {
  40.     int offs;
  41.  
  42.  
  43.     if (palette_recalc())
  44.         memset(dirtybuffer,1,videoram_size);
  45.  
  46.     /* for every character in the Video RAM, check if it has been modified */
  47.     /* since last time and update it accordingly. */
  48.     for (offs = videoram_size - 1;offs >= 0;offs--)
  49.     {
  50.         if (dirtybuffer[offs])
  51.         {
  52.             int sx,sy;
  53.  
  54.  
  55.             dirtybuffer[offs] = 0;
  56.  
  57.             sx = offs / 32;
  58.             sy = 31 - offs % 32;
  59.  
  60.             if (flipscreen)
  61.             {
  62.                 sx = 31 - sx;
  63.                 sy = 31 - sy;
  64.             }
  65.  
  66.             drawgfx(tmpbitmap,Machine->gfx[0],
  67.                     videoram[offs] + ((colorram[offs] & 0x18) << 5),
  68.                     colorram[offs] & 0x07,
  69.                     flipscreen,flipscreen,
  70.                     8*sx,8*sy,
  71.                     &Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  72.         }
  73.     }
  74.  
  75.  
  76.     /* copy the temporary bitmap to the screen */
  77.     copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  78.  
  79.     /* draw sprites */
  80.     for (offs = spriteram_size - 4;offs >= 0;offs -= 4)
  81.     {
  82.         int sx,sy,num, color,flipx,flipy;
  83.  
  84.         sx    = spriteram[offs + 1];
  85.         sy    = spriteram[offs];
  86.         num   = spriteram[offs + 2] + ((spriteram[offs + 3] & 0x08) << 5);
  87.         color = spriteram[offs + 3] & 0x07;
  88.         flipx = (spriteram[offs + 3] & 0x80);
  89.         flipy = (spriteram[offs + 3] & 0x40);
  90.  
  91.         if (flipscreen)
  92.         {
  93.             sx = 248 - sx;
  94.             sy = 248 - sy;
  95.             flipx = !flipx;
  96.             flipy = !flipy;
  97.         }
  98.  
  99.         drawgfx(bitmap,Machine->gfx[0],
  100.                 num,
  101.                 color,
  102.                 flipx,flipy,
  103.                 sx,sy,
  104.                 &Machine->drv->visible_area,TRANSPARENCY_PEN,0);
  105.     }
  106. }
  107.